<?php
include($_SERVER["DOCUMENT_ROOT"]."/bob.php");
include($_SERVER["DOCUMENT_ROOT"]."/fonctions_globales.php");
$mysqli = new_mysqli($host, $user, $password, $database); //connection à la DB

if($_SESSION['mdp_alpha'] != "yapudum1"){
    header("Location: identification.php");
	exit();
}

if(@$_GET['deco'] == "deco"){ //Demande de déconnexion
	reset_session($mysqli);
	header("Location: index.php");
	exit();
}
$mysqli = new_mysqli($host, $user, $password, $database); //connection à la DB
test_session_piratee($mysqli);
$_SESSION['lang'] = "fr";
/* TODO
//Selection de la langue par défaut. On regarde si un cookie l'applique, sinon on choisi la préférence du navigateur.
if($_SESSION['lang'] == "") { 
		if(@$_COOKIE['lang'] == NULL) {
			$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
			if ($lang == 'fr') $_SESSION['lang'] = "fr";
			else $_SESSION['lang'] = "en";
		} else $_SESSION['lang'] = $_COOKIE['lang'];
}*/

//On vérifie que le visiteur n'est pas banni, ni par son compte ni par son adresse IP
$query="SELECT * FROM banlist WHERE ban_ip = '{$_SERVER['REMOTE_ADDR']}'";
if(!empty($_SESSION['login']) && is_numeric(@$_SESSION['id'])) 
	$query = $query." OR ban_userid = '".$_SESSION['id']."'";
$ban = mysqli_query_with_error($mysqli, $query." LIMIT 1");
if($ban->num_rows > 0) {header("Location: /perso/banni.php"); exit();}

$reco = ""; 
if(empty($_SESSION['login']) && @$_COOKIE['auto']=='1' && @$_GET['mod'] != "deco") 
	$reco = "#reco"; //Cette instruction, passée ensuite à la page de contenu, permet d'établir la reconnection automatique si elle a lieu d'être.
?>

<!DOCTYPE html>
<html lang="fr" dir="ltr">

<head>
<meta charset="utf-8">
<meta http-equiv="Content-Language" content="fr">
<meta name="title" content="Post Human W.A.R."/>
<meta name="description" content="'"/>
<meta name="keywords" content="PHW, war, post, human, stratégie, jeu, réflexion, tactic, tactique, wraak, R-PATCH, anthropiste, stront, humour"/>
<meta name="rating" content="general"/>
<meta name="language" content="fr"/>
<meta name="author" content="Gabriel Wink"/>
<meta name="copyright" content="Gabriel WINK"/>
<meta name="reply-to" content="gabwink@gmail.com"/>
<meta name="expires" content="never"/>
<meta name="revisit-after" content="3 days"/>
<meta name="robots" content="all"/>

<title>Post Human W.A.R.</title>
<link rel='icon' type='image/png' href='/images/favicon.png' />
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<script type='text/javascript' src='/js/ouverture_module_jeu.js'></script>
<script type='text/javascript' src='/js/navigation_inter_frame.js'></script>
</head>
<body style="height:100%; overflow: hidden;" onload="charge_page_site('<?php echo $reco ?>');"  >
<iframe name="jeu_menu" id="jeu_menu" src="/jeu/module_jeu.php" style=" margin-bottom:-5px; height:0px;" scrolling="no" frameborder="0" border="0">
Votre navigateur semble ne pas accepter les frames, ce qui est obligatoire pour acceder au site. </iframe>
<iframe name="site_contenu" id="site_contenu" src="" style="margin-bottom:-25px; " scrolling="auto" frameborder="0" border="0"></iframe>
</body>

</html>